package com.szqhyxj.youxiangju.biz.receipt.success;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.KeyEvent;
import android.view.View;
import android.widget.LinearLayout;

import com.szqhyxj.youxiangju.BaseActivity;
import com.szqhyxj.youxiangju.R;
import com.szqhyxj.youxiangju.biz.receipt.ReceiptActivity;
import com.szqhyxj.youxiangju.biz.receipt.record.ReceiptRecordActicirty;
import com.szqhyxj.youxiangju.sys.components.NavigationBar;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by leung on 2018/11/25.
 */

public class ReceiptSuccessActivity extends BaseActivity implements NavigationBar.NavigationBarListener {

    @BindView(R.id.navigationBar)
    NavigationBar navigationBar;
    @BindView(R.id.tiparea)
    LinearLayout tiparea;

    private static final String ISSHOW = "isShow";
    Boolean isShow;
    public static void start(Activity activity,Boolean isShow) {
        Intent intent = new Intent();
        intent.setClass(activity, ReceiptSuccessActivity.class);
        intent.putExtra(ISSHOW,isShow);
        activity.startActivity(intent);

    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_receipt_success);
        ButterKnife.bind(this);
        navigationBar.setNavigationBarListener(this);
        isShow = getIntent().getBooleanExtra(ISSHOW,false);
        if (isShow){
            tiparea.setVisibility(View.VISIBLE);
        }else{
            tiparea.setVisibility(View.GONE);
        }
    }


    @Override
    public void navigationLeft() {
        ReceiptActivity.start(this);
        finish();
    }

    @Override
    public void navigationRight() {

    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_BACK) {
            ReceiptActivity.start(this);
            finish();
        }
        return super.onKeyDown(keyCode, event);
    }

    @OnClick({R.id.back, R.id.gorecord})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.back:
                ReceiptActivity.start(this);
                finish();
                break;
            case R.id.gorecord:
               // ReceiptRecordActicirty.start(this);
                break;
        }
    }
}
